Ext.grid.TaskSelectionModel = Ext.extend(Ext.grid.RowSelectionModel, {
    
    header: '<div class="x-grid3-hd-checker">&#160;</div>',
    
    width: 30,
    
    sortable: false,

    
    menuDisabled:true,
    fixed:true,
    dataIndex: '',
    id: 'task_checker',

    
    initEvents : function(){
        Ext.grid.TaskSelectionModel.superclass.initEvents.call(this);
        this.grid.on('render', function(){
            var view = this.grid.getView();
            view.mainBody.on('mousedown', this.onMouseDown, this);
//            Ext.fly(view.innerHd).on('mousedown', this.onHdMouseDown, this);
        }, this);
    },

    
    onMouseDown : function(e, t){
        if(e.button === 0 && t.className == 'x-grid3-row-checker'){ 
//            e.stopEvent();
            var row = e.getTarget('.x-grid3-row');
            if(row){
                var index = row.rowIndex;
				this.clearSelections();
				this.selectRow(index, false);
				var record = this.getSelected();
				if(record){
					record.set(this.dataIndex, !record.get(this.dataIndex));
					record.dirty = false;
//					console.log('Selected row: '+record.get('id')+', row is '+index+', checked: '+record.get(this.dataIndex));
				}
            }
        }
    },

        
    renderer : function(v, p, record){
//		console.log('renderer: '+record.get(this.dataIndex)+', v = '+v+', p = '+p);
		if(record.get('selectable'))
			return '<div class="x-grid3-row-checker" style="background-position: '+(v?'-23':'2')+'px 2px;">&#160;</div>';
		else
			return '&#160;';
    }
});
